/*
 * @Company: TWL
 * @Author: xue jian
 * @Email: xuejian@kanzhun.com
 * @Date: 2019-11-18 22:32:59
 */
#include "Eigen/Dense"
#include <iostream>
#include <memory>
#include <cstring>
using Eigen::MatrixXf;
using Eigen::Map;
int main() {
    // MatrixXf tmp(MatrixXf::Constant(4, 5, 0.87));
    std::vector<float> tmp({1, 2, 3, 4,5, 6, 7,8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20});
    MatrixXf mp_tmp(Map<MatrixXf>(&tmp.at(0), 4, 5));
    std::string media(sizeof(float)*tmp.size(), '0');
    std::memcpy(&media[0], &mp_tmp(0, 0), sizeof(float)*tmp.size());
    MatrixXf tmp2(MatrixXf::Zero(4, 5));
    std::memcpy(&tmp2(0, 0), &media[0], sizeof(float)*tmp2.size());
    std::cout<<tmp2<<std::endl;

    Map<MatrixXf> mp(&tmp.at(0), 4, 5);
    MatrixXf tmp_mp = tmp2*mp.transpose();
    std::cout<<"==============="<<std::endl;
    std::cout<<mp<<std::endl;
}